package com.boss.common.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.boss.common.entity.User;
import com.boss.common.entity.WfActionDTO;
import com.boss.framework.exception.AppRuntimeException;
import com.boss.salary.entity.ConfigCtrl;
import com.boss.salary.entity.PaymentMassage;
import com.boss.sys.ca.user.dto.UserDTO;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

public interface ICommonService {


    /**
     * 通过登录用户获取用户信息
     * @param user
     * @return
     */
    User getUserByToken(User user) throws AppRuntimeException;
    /**
     *根据用户guid获取菜单
     * @param year
     * @param province
     * @param userguid
     * @return
     */
    Map<String,String>getMenusByUserGuid(String year,String province,String userguid);

    /**
     * 通过user走接口登录
     * @param user
     * @return
     */
    Map<String,String> getUserLogin(User user);

    /**
     * 上传文件接口
     * @param file
     * @return
     */
    Map<String,String> uploadFile(MultipartFile file) throws  Exception;

    /**
     * 通过tokenid与appguid获取平台用户拥有菜单
     * @param user
     * @return
     */

    Map<String,String> getMenuTree(User user);

    /**
     * 获取机构指标
     * @param paramMap
     * @return
     */
    JSONArray getPayMent(Map<String,Object> paramMap, boolean initIndex,String tokenid);

    /**
     * 获取指标可用额度
     * @param bgtids
     * @param userDTO
     * @return
     */
    PaymentMassage getPayMent(List<String> bgtids, UserDTO userDTO,String tokenid);

    /**
     * 获取指标可用额度不带功能科目
     * @param bgtids
     * @param userDTO
     * @param tokenid
     * @return
     */
    PaymentMassage getPayMentNoFunc(List<String> bgtids, UserDTO userDTO,String tokenid);

    int getPayMentCount(Map<String,Object> paramMap, boolean initIndex,String tokenid);

    /**
     * 推送支付申请
     * @param paramMap
     * @return
     */
    Map<String, JSONObject> sentPayMent(List<Map<String, Object>> paramMap, String tokenid);

    /**
     * 推送支付申请(异步接口)
     * @param paramMap
     * @return
     */
    Map<String,String> sentPaymentAsync(List<Map<String, Object>> paramMap,String tokenid);

    /**
     * 获取异步生成支付进度
     * @param id 异步申请时返回的事件id
     * @return
     */
    Map<String,Object> sentPaymentProgress(String id);

    /**
     * 作废申请
     * @param paramMap
     * @return
     */
    Map<String,String> nullifyPayMent(List<String> paramMap,String tokenid);

    /**
     * 验证token合法性
     * @param token
     * @return
     */
    Map<String, Object> checkToken(String token);

    /**
     * 退出登录，删除tokenid
     * @param token
     * @return
     */
    Map<String, Object> logout(String token);
    /**
     * 获取有权限的单位树结构数据
     * @param userDTO
     * @return
     */
    List<Map<String, Object>> getAuthAgencyTree(UserDTO userDTO);

    /**
     * 获取有权限的单位树结构数据(过滤财务已送审)
     * @param userDTO
     * @return
     */
    List<Map<String, Object>> getAuthAgencyTrees(UserDTO userDTO);

    /**
     * 获取登录用户拥有权限中的一个机构
     * @param userDTO
     * @return
     */
    Map<String, Object> getFirstAuthAgencyData(UserDTO userDTO);

    /**
     * 获取单位拓展信息
     * @param tokenid
     * @param agencyId
     * @return
     */
    List<Map> getAgencyInfo(String tokenid, String agencyId);

    /**
     * 获取单位树结构数据
     * @param agencyId
     * @return
     */
    List<Map<String, Object>> getAgencyTree(String agencyId,UserDTO userDTO);
    /**
     * 获取指定id下的叶子节点id
     * @param agencyId
     * @return
     */
    List<String> getAgencyChildrenId(UserDTO userDTO, String agencyId);
    /**
     * 获取指定id下的叶子节点id查所有包括删除的
     * @param agencyId
     * @return
     */
    List<String> getAgencyChildrenIds(UserDTO userDTO, String agencyId);

    /**
     * 在预算系统中通过单位ID获取人员数据
     * @param agency_id
     * @return
     */
//    List<PersonOperate> getPersonInfoByAgency4Buget(String agency_id, String code) throws FileNotFoundException;

    /**
     * 获取菜单id
     * @param wfActionDTO
     * @return
     */
    String getMenuid(WfActionDTO wfActionDTO);

    String getWorkflowWheresql(WfActionDTO wfActionDTO, String alias);

    /**
     * 给平台推送消息
     * @param userDTO
     * @param agengcyId
     * @param message
     */
    void  pushMessageToApaas(UserDTO userDTO,String agengcyId,String message);

    /**
     * 指标冻结
     * @param sum_id
     * @param amount
     * @param province
     * @param year
     * @param specialSql
     * @return
     */
    Map<String,String> gocpurbudgetFrozen(String sum_id,String amount,String province,String year,String specialSql);

    /**
     * 指标解冻
     * @param sum_id
     * @param amount
     * @param province
     * @param year
     * @param specialSql
     * @return
     */
    Map<String,String> gocpurbudgetThaw(String sum_id,String amount,String province,String year,String specialSql);

    /**
     * 批量指标冻结
     * @param payList sum_id amount
     * @param province
     * @param year
     * @param specialSql
     * @return
     */
    Map<String,String> batchGocpurbudgetFrozen(List<Map<String,Object>> payList,String province,String year,String specialSql)  throws Exception ;

    /**
     * 批量指标解冻
     * @param payList sum_id amount
     * @param province
     * @param year
     * @param specialSql
     * @return
     */
    Map<String,String> batchGocpurbudgetThaw(List<Map<String,Object>> payList,String province,String year,String specialSql);

    /**
     * 通过传入的type查询基础表数据
     * @param queryParam
     * @return
     */
    List<Map<String, Object>> queryBaseDataList(Map<String, Object> queryParam);

    /**
     * 获取基础数据Map
     * @param type
     * @param mofDivCode
     * @return
     */
    Map<String, Object> queryBaseDataMap(String type,String mofDivCode);

    /**
     * 获取工资项基础数据Map 返回的工资项id和工资项名称map
     * @param mofDivCode
     * @return
     */
    Map<String, Object> querySalaryBaseDataMap(String mofDivCode);

    /**
     * 获取区划下配置开关
     * @param type
     * @param mof_div_code
     * @return
     */
    ConfigCtrl selectConfigCtrlByTypeMof(String type, String mof_div_code);

    /**
     * 获取平台单位
     * @param userDTO
     * @return
     */
    List<Map<String, Object>> getAgency(UserDTO userDTO);

    /**
     * 获取有权限的单位树结构数据
     * @param userDTO
     * @return
     */

    List<Map<String, Object>> getNotAuditAuthAgencyTree(UserDTO userDTO);


}
